﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using com.zjgis.baseTools;
using ZJGIS.DataConvert.form;
using ESRI.ArcGIS.Controls;
using System.IO;
using System.Drawing;
using com.zjgis.utility;

namespace ZJGIS.DataConvert.button
{
    public class btnDataTransformation : CommandTemplate
    {
        public btnDataTransformation()
        {
            base.m_caption = "坐标系统转换";
            Stream stream = ResourceManager.GetImageStream(GetType());
            if (stream != null)
            {
                base.Image = Image.FromStream(stream);
            }
            base.m_toolTip = base.m_caption;
        }

        public override void ComponentUpdate()
        {
            if (statusController.Host == null)
            {
                m_enabled = false;
            }
            else
            {
                if (statusController.Host is AxMapControl)
                {
                    m_enabled = true;
                }
                else
                {
                    m_enabled = false;
                }
            }
        }

        public override void OnClick()
        {
            FrmDataTransformation frmDataTransformation = FrmDataTransformation.GetDataTransformationForm();
            frmDataTransformation.MapControlOutProp = statusController.Host as AxMapControl;
            if (frmDataTransformation.Visible == false) 
                frmDataTransformation.Show(statusController.FrameController.FormControl);
        }
    }
}
